home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d6
/
glazer.arc
/
PERRATE.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-10-07
|
2KB
|
50 lines
100 'Periodic Rate ("PERRATE")
110 CLS
120 COLOR 0,15 : PRINT "Periodic Rate" : COLOR 15,0
130 DEFSNG A-Z
140 DEFINT M-N
150 ' Define function to convert periodic rate to annual rate
160 DEF FNA (V) = ( (1 + V) ^ NPY - 1) * 100
170 PCTFMT$ = "###.##_%"
180 ' Let user enter data
190 PRINT : PRINT "Do not enter dollar signs or commas"
200 PRINT
210 INPUT "Savings goal: ", FV
220 INPUT "Deposit each period: ", DEPOSIT
230 INPUT "Term in years: ", NYEARS
240 INPUT "Number of deposits per year: ", NPY
250 INPUT "Annual inflation rate (in percent): ", INFLATION
260 INPUT "Marginal tax rate (in percent): ", TAXRATE
270 ' Find interest rate for nominal goal
280 RLOWER = 0 'Initial values
290 RUPPER = .5
300 WHILE (RUPPER - RLOWER) > .00001
310 PR = (RLOWER + RUPPER) / 2
320 'Calculate payment for trial value
330 TRIALDEP = FV / ( (1 + PR) * ( (1 + PR) ^ (NPY * NYEARS) - 1) / PR)
340 IF TRIALDEP < DEPOSIT THEN RUPPER = PR ELSE RLOWER = PR
350 WEND
360 PR = (RUPPER + RLOWER) / 2 'Convert to annual, taxable rate
370 AR = FNA (PR)
380 RTAXABLE = FNA (PR / (1 - TAXRATE / 100) )
390 ' Interest rate for inflated goal
400 RLOWER = 0 'Initial values
410 RUPPER = .5
420 INFLATION = (1 + INFLATION / 100) ^ (1 / NPY) - 1
430 FVADJUSTED = FV * (1 + INFLATION) ^ (NPY * NYEARS)
440 WHILE (RUPPER - RLOWER) > .00001
450 PR = (RLOWER + RUPPER) / 2
460 'Calculate payment for trial value
470 TRIALDEP = FVADJUSTED / ((1 + PR) * ((1 + PR) ^ (NPY * NYEARS) - 1) / PR)
480 IF TRIALDEP < DEPOSIT THEN RUPPER = PR ELSE RLOWER = PR
490 WEND
500 RADJTAX = (RUPPER + RLOWER) / 2 'Convert to annual, taxable rate
510 RADJTAX = FNA(PR / (1 - TAXRATE / 100))
520 ' Print results
530 PRINT:PRINT
540 PRINT "Tax-free interest rate:"; TAB(41); USING PCTFMT$; AR
550 PRINT "Taxable interest rate:"; TAB(41); USING PCTFMT$; RTAXABLE
560 PRINT "Taxable interest rate for inflated goal:"; TAB(41);
570 PRINT USING PCTFMT$; RADJTAX
580 END